<template>
  <!-- 添加或修改付款申请单对话框 -->
  <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body :close-on-click-modal="false" v-dialogDrag>
    <el-row :gutter="10">
      <el-card class="box-card">
        <el-descriptions class="margin-top " :contentStyle="CS" :label-style="LS" title="" :column="3"
                         size="medium" border>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-c-scale-to-original"></i>
              抽检批次号
            </template>
            {{ form.batchNumber }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-money"></i>
              样品编号
            </template>
            {{ form.sampleNumber }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-money"></i>
              检验时间
            </template>
            {{ parseTime(form.inspectTime, '{y}-{m}-{d}') }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-money"></i>
              是否合格
            </template>
            <dict-tag :options="dict.type.yes_no" :value="form.testPass"/>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-money"></i>
              破坏载荷（要求值）
            </template>
            {{ form.destructionStandard }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-user"></i>
              破坏载荷（实测值）
            </template>
            {{ form.destructionTest }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-bank-card"></i>
              来料检测报告
            </template>
            <file-upload-show :value="form.reportFile"></file-upload-show>
          </el-descriptions-item>

        </el-descriptions>
      </el-card>
    </el-row>

    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
    </div>
  </el-dialog>
</template>

<script>
import {accAdd, downloadFile, getById} from '@/api/manage';
import FileUploadShow from "@/components/FileUpload/FileUploadShow.vue";

export default {
  name: "FactoryTestMachineryLinkDetail",
  dicts: ["yes_no"],
  components: {FileUploadShow},
  data() {
    return {
      // 遮罩层
      loading: true,
      activeName: "first",
      // 弹出层标题
      title: "付款申请单详情",
      // 是否显示弹出层
      open: false,
      // 表单参数
      form: {},
      buyDetailList: [],
      payApplyBuyList: [],
      payApplyBuyDetailList: [],
      buyId: null,
      applyId: null,
      // 总条数
      total: 0,
      CS: {
        'text-align': 'center',  //文本居中
        'min-width': '250px',   //最小宽度
        'word-break': 'break-all'  //过长时自动换行
      },
      LS: {
        'color': '#000',
        'text-align': 'center',
        'font-weight': '600',
        'height': '40px',
        'min-width': '110px',
        'word-break': 'keep-all'
      },
      buy: {},
      // 表单校验
      rules: {},
      url: {
        getById: '/factoryTestMachineryLink/factoryTestMachineryLink/',
      },
      baseUrl: process.env.VUE_APP_BASE_API,
    };
  },
  created() {

  },
  methods: {
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        type: null,
        buyId: null,
        applyTime: null,
        invoiceCode: null,
        invoicePhoto: null,
        totalMoney: null,
        paidMoney: null,
        remainMoney: null,
        remark: null,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      };
      this.resetForm("form");
    },

    showDetail(row) {
      this.reset();
      const id = row.id || this.ids;
      getById(this.url.getById, id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "查看质检详情";
      });
    },

  }
};
</script>

